//设置 Linux服务器数据库可以在任意服务器上远程连接 $ mysql -u root -p mysql> show databases; mysql> use mysql; mysql> select host, user from user; mysql> update user set host = '%' where user = 'root'; mysql> flush privileges; mysql> exit;
从命令行终端运行此命令,将在寻找Linux/BSD / OS X系统中的MySQL配置文件 my.cnf 文件:
mysql --help | grep 'Default options' -A 1 上面命令执行后,会有这样的输出:
Default options are read from the following files in the given order: /etc/my.cnf /etc/mysql/my.cnf /usr/local/etc/my.cnf ~/.my.cnf /etc/mysql/mysql.conf.d mysql配置文件 现在,可以检查你正在使用的 my.cnf 文件是否存在。在 Mac OS X 中默认式没有 my.cnf 文件的。你可以从这个地方复制一份过去 /usr/local/mysql/support-files/my-default.cnf 每个版本都不一样,你只需要找到一个 .cnf